import {tableOptBtnConfig} from "../table";
import {commonConfig} from '@/config/common';
import {tableTextColumnMap} from "@/utils";

export default {
  "tableId": "protocol",
  "name": "设备协议",
  "columns": [
    {
      label: '协议编号',
      width: 100,
      children: [
        {
          key: 'protocolNo',
        },
      ]
    },
    {
      label: '协议名称',
      width: 300,
      children: [
        {
          key: 'protocolName',
          tooltip: true,
        },
      ]
    },
    {
      label: '协议标识',
      children: [
        {
          key: 'protocolMarkText',
        },
      ],
    },
    {
      label: '链路类型',
      width: 150,
      children: [
        {
          key: 'linkTypeName',
        },
      ],
    },
    {
      label: '协议类型',
      children: [
        {
          key: 'protocolType',
        },
      ],
    },
    {
      label: '数据采集方式',
      width: 100,
      children: [
        {
          key: 'collectWay',
          mapFunc: (data) => tableTextColumnMap(data, commonConfig.collectType)
        },
      ]
    },
    {
      label: '协议版本',
      children: [
        {
          key: 'protocolVer',
        }
      ],
    },
    {
      label: '最小采集周期',
      width: 120,
      children: [
        {
          key: 'minCollectInterval',
        }
      ],
    },
    {
      label: '备注',
      children: [
        {
          key: 'remarks',
          tooltip: true
        }
      ],
    },
    {
      label: '更新时间',
      width: 100,
      children: [
        {
          updatedDate: true
        }
      ],
    },
    {
      "label": "操作",
      "operation": true,
      "width": 260,
      "children": [
        {
          "button": true,
          type: tableOptBtnConfig.edit.type,
        },
        {
          "button": true,
          type: tableOptBtnConfig.command.type,
        },
        {
          "button": true,
          type: tableOptBtnConfig.widgetList.type,
        },
        {
          'dropdown': true,
          'options': [
            // {
            //   type: tableOptBtnConfig.widgetList.type,
            //   label: '小组件',
            // },
            {
              type: 'upload',
              label: '协议文档管理',
            },
            {
              type: 'relateProtocol',
            },
            {
              type: 'copy',
            },
            {
              type: 'delete',
              class: 'font-hover-danger'
            }
          ]
        }
      ]
    }
  ],
  "filters": [
    {
      "fieldType": "string",
      key: 'deviceType',
      label: '设备类别',
      "dataApi": API.deviceType.deviceTypeAll,
      "options": []
    },
    {
      "fieldType": "string",
      key: 'manufacturer',
      label: '设备厂家',
      "dataApi": API.manufacturer.manufacturerAll,
      "options": []
    },
    {
      "fieldType": "string",
      key: 'linkType',
      label: '链路类型',
      "dataApi": API.linkType.linkTypeAll,
      "options": []
    },
    {
      "fieldType": "string",
      key: 'protocolType',
      label: '传输类型',
      "dataApi": API.protocolType.protocolTypeAll,
      "options": []
    },
    {
      "fieldType": "string",
      key: 'protocolMark',
      label: '协议标识',
      options: commonConfig.protocolMark
    },
    {
      "fieldType": "input",
      key: 'protocolName',
      label: '协议名称',
    },
    // {
    //   "fieldType": "input",
    //   key: 'manufacturer',
    //   label: '厂家',
    // },
    {
      "fieldType": "input",
      key: 'remarks',
      label: '备注',
    },
  ]
}
